#pragma once

#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>

class Util
{
public:
    static void StringSplit(const std::string& str,const std::string& SEP,std::vector<std::string>* result)
    {
        size_t start = 0;
        while(start < str.size())
        {
            size_t pos = str.find(SEP,start);//从start位置开始找
            if(pos == std::string::npos)
                break;
            result->push_back(str.substr(start,pos-start));//左闭右开，个数刚刚好
            start = pos + SEP.size(); 
        }
        result->push_back(str.substr(start));//注意最后一个也要存进去
    }

    static int ToInt(const std::string str)
    {
        return atoi(str.c_str());
    }
};


